home *** CD-ROM | disk | FTP | other *** search
- property friction, xpos, ypos, oldxpos, oldypos, xvel, yvel, mass, xacc, yacc, enable
-
- on getPropertyDescriptionList
- set D to [:]
- addProp(D, #friction, [#default: 0.80000000000000004, #format: #float, #comment: "Friction:", #range: [#min: 0.0, #max: 1.0]])
- addProp(D, #xacc, [#default: 0.0, #format: #float, #comment: "Accel X Magnitude:"])
- addProp(D, #yacc, [#default: 0.0, #format: #float, #comment: "Accel Y Magnitude:"])
- addProp(D, #xvel, [#default: 0.0, #format: #float, #comment: "Velocity X Magnitude:"])
- addProp(D, #yvel, [#default: 0.0, #format: #float, #comment: "Velocity Y Magnitude:"])
- return D
- end
-
- on beginSprite me
- set the xpos of me to the locH of sprite the spriteNum of me
- set the ypos of me to the locV of sprite the spriteNum of me
- set the oldxpos of me to the xpos of me
- set the oldypos of me to the ypos of me
- set the mass of me to 0.0
- set the enable of me to 0
- end
-
- on move me
- if the enable of me then
- set the xvel of me to the xvel of me + the xacc of me
- set the yvel of me to the yvel of me + the yacc of me
- set the xvel of me to the xvel of me * the friction of me
- set the yvel of me to the yvel of me * the friction of me
- set the xpos of me to the xpos of me + the xvel of me
- set the ypos of me to the ypos of me + the yvel of me
- set the locH of sprite the spriteNum of me to the xpos of me
- set the locV of sprite the spriteNum of me to the ypos of me
- end if
- end
-
- on exitFrame me
- if the enable of me then
- move(me)
- end if
- end
-
- on start me
- set the enable of me to 0
- end
-
- on stop me
- set the enable of me to 0
- end
-
- on setVelocity me
- set currx to the locH of sprite the spriteNum of me
- set curry to the locV of sprite the spriteNum of me
- set the xvel of me to currx - the oldxpos of me
- set the yvel of me to curry - the oldypos of me
- set the oldxpos of me to currx
- set the oldypos of me to curry
- set the xpos of me to the locH of sprite the spriteNum of me
- set the ypos of me to the locV of sprite the spriteNum of me
- end
-